package com.jensen.model;

import javax.persistence.*;
import java.util.List;

/**
 * Created by sjj on 2015/10/24 0024.
 */
@Entity
@Table(name = "tb_user")
public class User {
    @Id
    private int id;
    private String firstName;
    private String lastName;
    private String password;

    @OneToMany(orphanRemoval = true,fetch = FetchType.EAGER,mappedBy = "user",cascade = CascadeType.ALL)
    private List<Blog> blogs;


    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public List<Blog> getBlogs() {
        return blogs;
    }

    public void setBlogs(List<Blog> blogs) {
        this.blogs = blogs;
    }

    public User(int id, String firstName, String lastName, String password) {
        this.id = id;
        this.firstName = firstName;
        this.lastName = lastName;
        this.password = password;
    }

    public User(){}
}
